$(function(){
//自适应移动端比例
function rem(size){
    var clientW=document.documentElement.clientWidth;
    var bili=clientW/size;
    var fontSize=bili*100;
    document.getElementsByTagName("html")[0].style.fontSize=fontSize+"px"
}
rem(750);
/*********************************/
//页面上部按钮样式动画及接口
function btn(){
	this.btnLeft=$("#footerLeftBtn")[0];
	this.flag1=true;
	this.btnRight=$("#footerRightBtn")[0];
	this.flag2=true;
	this.footerLeft=$(".footerLeft")[0];
	this.footerRight=$(".footerRight")[0];
	this.left1=$(".leftBtn1")[0];
	this.left2=$(".leftBtn2")[0];
	this.left3=$(".leftBtn3")[0];
	this.left4=$(".leftBtn4")[0];
	this.right1=$(".rightBtn1")[0];
	this.right2=$(".rightBtn2")[0];
	this.right3=$(".rightBtn3")[0];
	this.right4=$(".rightBtn4")[0];
	this.leftTop1=$(".grBtn1")[0];
	this.leftTop2=$(".grBtn2")[0];
	this.leftTop3=$(".grBtn3")[0];
	this.leftTop4=$(".grBtn4")[0];
	this.qiandaoBtn=$(".qiandao")[0];
	this.pandaBtn=$(".panda")[0];
	this.diaoxiang1=$(".diaoxiang1")[0];
	this.diaoxiang2=$(".diaoxiang2")[0];
	this.diaoxiang3=$(".diaoxiang3")[0];
	this.diaoxiang4=$(".diaoxiang4")[0];
	this.remove=$(".remove");
	this.chongzhiBtn=$(".chongzhiBox a");
	this.quxiao=$(".quxiao");
	this.queding=$(".queding");
	this.go_chongzhi=$(".go_chongzhi")[0];
	this.filter=$(".submit")[0];
	this.go_friend=$(".find_friend a")[0];
	this.qiehuan=$(".qiehuan")[0];
	this.audioBtn=$(".audio")[0];
	this.audioImg=$(".audioImg")[0];
	this.audio1=$("#audio1")[0];
	this.leftBtn=$(".leftBtn");
	this.rightBtn=$(".rightBtn");
	this.emptyBtn=$(".empty");
	this.paihangTop=$(".paihangTop li");
	this.find_go=$(".find_go")[0];
	this.gerenImg=$(".gerenBox img")[0];
	this.pandaTop=$(".pandaTop li");
	this.getjineng=$(".pandaBot li:nth-of-type(2) a");
	this.xunlianBtn=$(".xunlian")[0];
	this.weishiBtn=$(".weishi")[0];
	this.pandaJia=$(".pandaJia")[0];
	this.pandaJian=$(".pandaJian")[0];
	this.changeName=$(".changeName")[0];
	this.changeFlag=true;
	this.cangkuList=$(".cangkuTop li");
	this.duihuanList=$(".duihuanTop li");
	this.duihuan=$(".shuiguoduihuan");
	this.shangdianList=$(".shangdianTop li");
	this.shangdian=$(".shuiguogoumai");
	this.shuiguoJia=$(".shuiguoJia");
	this.shuiguoJian=$(".shuiguoJian");
	this.jiansheList=$(".jiansheTop li");
	this.tudishengji=$(".tudishengji");
	this.yinxiao=$("#audio2")[0];
	this.BigHouse=$(".BigHouse")[0];
	this.SmallHouse=$(".SmallHouse")[0];
	this.htmlArr=["主人我饿了，请给我喂食吧!",
				  "主人听说下雨天要打伞哦!",
				  "主人听说仟源科技很厉害哦!",
				  "主人听说仟源科技很强大哦!",
				  "主人听说仟源科技都是帅哥美女哦!"]
};
btn.prototype={
	init:function(){
		var that=this;
		that.leftAnimate();
		that.rightAnimate();
		that.left_btn();
		that.right_btn();
		that.leftTop_btn();
		that.qiandao_btn();
		that.panda_btn();
		that.diaoxiang_btn1();
		that.diaoxiang_btn2();
		that.diaoxiang_btn3();
		that.diaoxiang_btn4();
		that.remove_btn();
		that.chongzhi_btn();
		that.quxiao_btn();
		that.queding_btn();
		that.go_chongzhi_btn();
		that.filter_btn();
		that.go_friend_btn();
		that.qiehuan_btn();
		that.audioBtn_btn();
		that.left_go();
		that.right_go();
		that.empty_btn();
		that.paihang_btn();
		that.find_go_btn();
		that.gerenImg_btn();
		that.pandaTop_btn();
		that.getjineng_btn();
		that.xunlianBtn_btn();
		that.weishiBtn_btn();
		that.pandaJia_btn();
		that.pandaJian_btn();
		that.changeName_btn();
		that.cangkuList_btn();
		that.duihuanList_btn();
		that.duihuan_btn();
		that.shangdianList_btn();
		that.shangdian_btn();
		that.shuiguoJia_btn();
		that.shuiguoJian_btn();
		that.jiansheList_btn();
		that.tudishengji_btn();
		that.BigHouse_btn();
		that.SmallHouse_btn();
		that.html_arr_btn();
	},
	leftAnimate:function(){
		var that=this;
		that.btnLeft.addEventListener("touchstart",function(e){
            e.preventDefault();
            that.btnLeft.style.background="url("+PUBLIC+"/gold/img/index/5.png)";
            that.btnLeft.style.backgroundSize="cover";
            that.yinxiao_btn();
       	},false);
       	that.btnLeft.addEventListener("touchend",function(e){
            e.preventDefault();
            that.btnLeft.style.background="url("+PUBLIC+"/gold/img/index/left_bot.png)";
            that.btnLeft.style.backgroundSize="cover";
            if(that.flag1 == true){
            	that.footerLeft.style.transform="rotate(0deg)";
            	that.flag1=false;
            }else{
            	that.footerLeft.style.transform="rotate(90deg)";
            	that.flag1=true;
            }
       	},false);
	},
	rightAnimate:function(){
		var that=this;
		that.btnRight.addEventListener("touchstart",function(e){
            e.preventDefault();
            that.btnRight.style.background="url("+PUBLIC+"/gold/img/index/10.png)";
            that.btnRight.style.backgroundSize="cover";
            that.yinxiao_btn();
       	},false);
       	that.btnRight.addEventListener("touchend",function(e){
            e.preventDefault();
            that.btnRight.style.background="url("+PUBLIC+"/gold/img/index/right_bot.png)";
            that.btnRight.style.backgroundSize="cover";
            if(that.flag2 == true){
            	that.footerRight.style.transform="rotate(0deg)";
            	that.flag2=false;
            }else{
            	that.footerRight.style.transform="rotate(-90deg)";
            	that.flag2=true;
            }
       	},false);
	},
	left_btn:function(){
		var that=this;
		//游戏公告
		that.left1.addEventListener("touchstart",function(e){
            e.preventDefault();
            that.left1.style.background="url("+PUBLIC+"/gold/img/index/1.png)";
            that.left1.style.backgroundSize="cover";
            that.yinxiao_btn();
       	},false);
       	that.left1.addEventListener("touchend",function(e){
            e.preventDefault();
            that.left1.style.background="url("+PUBLIC+"/gold/img/index/left_1.png)";
            that.left1.style.backgroundSize="cover";
            window.location.href="noticeList"
       	},false);
       	//攻略资料
		that.left2.addEventListener("touchstart",function(e){
            e.preventDefault();
            that.left2.style.background="url("+PUBLIC+"/gold/img/index/2.png)";
            that.left2.style.backgroundSize="cover";
            that.yinxiao_btn();
       	},false);
       	that.left2.addEventListener("touchend",function(e){
            e.preventDefault();
            that.left2.style.background="url("+PUBLIC+"/gold/img/index/left_2.png)";
            that.left2.style.backgroundSize="cover";
            window.location.href="rem_zy/html/exhibition.html"
       	},false);
       	//用户中心
		that.left3.addEventListener("touchstart",function(e){
            e.preventDefault();
            that.left3.style.background="url("+PUBLIC+"/gold/img/index/3.png)";
            that.left3.style.backgroundSize="cover";
            that.yinxiao_btn();
       	},false);
       	that.left3.addEventListener("touchend",function(e){
            e.preventDefault();
            that.left3.style.background="url("+PUBLIC+"/gold/img/index/left_3.png)";
            that.left3.style.backgroundSize="cover";
            // window.location.href="rem_zy/html/userCenter.html"
            window.location.href=APP+"/Member/memberCenter.html"
       	},false);
       	//农贸市场
		that.left4.addEventListener("touchstart",function(e){
            e.preventDefault();
            that.left4.style.background="url("+PUBLIC+"/gold/img/index/4.png)";
            that.left4.style.backgroundSize="cover";
            that.yinxiao_btn();
       	},false);
       	that.left4.addEventListener("touchend",function(e){
            e.preventDefault();
            that.left4.style.background="url("+PUBLIC+"/gold/img/index/left_4.png)";
            that.left4.style.backgroundSize="cover";
            window.location.href="rem_zy/html/market.html"
       	},false);
	},
	right_btn:function(){
		var that=this;
		//商店
		that.right1.addEventListener("touchstart",function(e){
            e.preventDefault();
            that.right1.style.background="url("+PUBLIC+"/gold/img/index/6.png)";
            that.right1.style.backgroundSize="cover";
            that.yinxiao_btn();
       	},false);
       	that.right1.addEventListener("touchend",function(e){
            e.preventDefault();
            that.right1.style.background="url("+PUBLIC+"/gold/img/index/right_1.png)";
            that.right1.style.backgroundSize="cover";

            //加载商店默认选项卡商品
            /*$.ajax({

                type: "POST",
                url:APP+"/Farm/commodityList.html",
                data:{typeId:1},
                dataType:"json",
                beforeSend:function(){
                    $('shangdianBot').empty()
                },
                success: function(data){

                    datas=eval(data)

                    if(datas != null) {

                        var count = datas.length;

                        for (var i = 0; i < count; i++) {

                            var industry = datas[i];


                            $('.shangdianBot').html(
                                "<li>"
                                + " <div class='gongyongList'>"
                                + "<div class='dhImgLeft'><img src='"+PUBLIC + "/UploadFiles_s/"+ industry.com_img + "' alt='' /></div>"
                                + "<div class='shuiguogoumai animated'></div>"
                                + "<p>" + industry.com_name + "x1000</p>"
                                + "<p>" + industry.com_describe + "</p>"
                                + "<p>钻石：" + industry.com_price + "</p>"
                                + "<p>剩余" + industry.com_sum + "万</p>"
                                + "</div>"
                                + "</li>"
                            );
                        }

                    }


                },
            })*/

            $(".shade").css("display","block");
            $(".shangdianBox").css("display","block").removeClass("bounceOut").addClass("bounceIn")
       	},false);
       	//仓库
		that.right2.addEventListener("touchstart",function(e){
            e.preventDefault();
            that.right2.style.background="url("+PUBLIC+"/gold/img/index/7.png)";
            that.right2.style.backgroundSize="cover";
            that.yinxiao_btn();
       	},false);
       	that.right2.addEventListener("touchend",function(e){
            e.preventDefault();
            that.right2.style.background="url("+PUBLIC+"/gold/img/index/right_2.png)";
            that.right2.style.backgroundSize="cover";
            $(".shade").css("display","block");
            $(".cangkuBox").css("display","block").removeClass("bounceOut").addClass("bounceIn")
       	},false);
       	//兑换中心
		that.right3.addEventListener("touchstart",function(e){
            e.preventDefault();
            that.right3.style.background="url("+PUBLIC+"/gold/img/index/8.png)";
            that.right3.style.backgroundSize="cover";
            that.yinxiao_btn();
       	},false);
       	that.right3.addEventListener("touchend",function(e){
            e.preventDefault();
            that.right3.style.background="url("+PUBLIC+"/gold/img/index/right_3.png)";
            that.right3.style.backgroundSize="cover";
            $(".shade").css("display","block");
            $(".duihuanBox").css("display","block").removeClass("bounceOut").addClass("bounceIn")
       	},false);
       	//装扮
		that.right4.addEventListener("touchstart",function(e){
            e.preventDefault();
            that.right4.style.background="url("+PUBLIC+"/gold/img/index/9.png)";
            that.right4.style.backgroundSize="cover";
            that.yinxiao_btn();
       	},false);
       	that.right4.addEventListener("touchend",function(e){
            e.preventDefault();
            that.right4.style.background="url("+PUBLIC+"/gold/img/index/right_4.png)";
            that.right4.style.backgroundSize="cover";
            $(".shade").css("display","block");
            $(".zhuangbanBox").css("display","block").removeClass("bounceOut").addClass("bounceIn")
       	},false);
	},
	leftTop_btn:function(){
		var that=this;
		//日志
		that.leftTop1.addEventListener("touchstart",function(e){
            e.preventDefault();
            that.leftTop1.classList.add("bounce");
            setTimeout(function(){
            	that.leftTop1.classList.remove("bounce");
            },1000)
            that.yinxiao_btn();
       	},false);
       	that.leftTop1.addEventListener("touchend",function(e){
            e.preventDefault();
            $(".shade").css("display","block");
            $(".rizhiBox").css("display","block").removeClass("bounceOut").addClass("bounceIn")
       	},false);
       	//排行榜
		that.leftTop2.addEventListener("touchstart",function(e){
            e.preventDefault();
            that.leftTop2.classList.add("bounce");
            setTimeout(function(){
            	that.leftTop2.classList.remove("bounce");
            },1000)
            that.yinxiao_btn();
       	},false);
       	that.leftTop2.addEventListener("touchend",function(e){
            e.preventDefault();
            $(".shade").css("display","block");
            $(".paihangbang").css("display","block").removeClass("bounceOut").addClass("bounceIn")
       	},false);
       	//充值
		that.leftTop3.addEventListener("touchstart",function(e){
            e.preventDefault();
            that.leftTop3.classList.add("bounce");
            setTimeout(function(){
            	that.leftTop3.classList.remove("bounce");
            },1000)
            that.yinxiao_btn();
       	},false);
       	that.leftTop3.addEventListener("touchend",function(e){
            e.preventDefault();
            $(".shade").css("display","block");
            $(".chongzhiBox").css("display","block").removeClass("bounceOut").addClass("bounceIn")
       	},false);
       	//设置
		that.leftTop4.addEventListener("touchstart",function(e){
            e.preventDefault();
            that.leftTop4.classList.add("bounce");
            setTimeout(function(){
            	that.leftTop4.classList.remove("bounce");
            },1000)
            that.yinxiao_btn();
       	},false);
       	that.leftTop4.addEventListener("touchend",function(e){
            e.preventDefault();
            $(".shade").css("display","block");
            $(".shezhiBox").css("display","block").removeClass("bounceOut").addClass("bounceIn")
            if(that.audio1.paused){
            	$(".audio img").css("display","block");
            	that.audioImg.style.background="url("+PUBLIC+"/gold/img/index/shezhi/yinxiaoyiguanbi.png)";
            	that.audioImg.style.backgroundSize="cover";
            }else{
            	$(".audio img").css("display","none");
            	that.audioImg.style.background="url("+PUBLIC+"/gold/img/index/shezhi/yinxiaoyikaiqi.png)";
            	that.audioImg.style.backgroundSize="cover";
            };
       	},false);
	},
	qiandao_btn:function(){
		var that=this;
		that.qiandaoBtn.addEventListener("touchstart",function(e){
            e.preventDefault();
            that.yinxiao_btn();
       	},false);
       	that.qiandaoBtn.addEventListener("touchend",function(e){
            e.preventDefault();
            that.qiandaoBtn.classList.remove("pulse","infinite");
            setTimeout(function(){
            	that.qiandaoBtn.classList.add("bounceOut");
            },500);
       	},false);
	},
	panda_btn:function(){
		var that=this;
		that.pandaBtn.addEventListener("touchstart",function(e){
            e.preventDefault();
            that.pandaBtn.classList.add("tada");
            setTimeout(function(){
            	that.pandaBtn.classList.remove("tada");
            },500);
            that.yinxiao_btn();
       	},false);
       	that.pandaBtn.addEventListener("touchend",function(e){
            e.preventDefault();
            $(".shade").css("display","block");
            $(".pandaBox").css("display","block").removeClass("bounceOut").addClass("bounceIn")
       	},false);
	},
	diaoxiang_btn1:function(){
		var that=this;
		that.diaoxiang1.addEventListener("touchstart",function(e){
            e.preventDefault();
            that.diaoxiang1.style.cssText="width:0.55rem;height:1.3rem;";
            $(".diaoxiang1 .diaoxiangBox").css("transform","scale(1,1)")
            that.yinxiao_btn();
       	},false);
       	that.diaoxiang1.addEventListener("touchend",function(e){
            e.preventDefault();
            that.diaoxiang1.style.cssText="width:0.69rem;height:1.47rem;";
            $(".diaoxiang1 .diaoxiangBox").css("transform","scale(0,0)")
       	},false);
	},
	diaoxiang_btn2:function(){
		var that=this;
		that.diaoxiang2.addEventListener("touchstart",function(e){
            e.preventDefault();
            that.diaoxiang2.style.cssText="width:0.55rem;height:1.3rem;";
            $(".diaoxiang2 .diaoxiangBox").css("transform","scale(1,1)")
            that.yinxiao_btn();
       	},false);
       	that.diaoxiang2.addEventListener("touchend",function(e){
            e.preventDefault();
            that.diaoxiang2.style.cssText="width:0.69rem;height:1.47rem;";
            $(".diaoxiang2 .diaoxiangBox").css("transform","scale(0,0)")
       	},false);
	},
	diaoxiang_btn3:function(){
		var that=this;
		that.diaoxiang3.addEventListener("touchstart",function(e){
            e.preventDefault();
            that.diaoxiang3.style.cssText="width:0.55rem;height:1.3rem;";
            $(".diaoxiang3 .diaoxiangBox").css("transform","scale(1,1)")
            that.yinxiao_btn();
       	},false);
       	that.diaoxiang3.addEventListener("touchend",function(e){
            e.preventDefault();
            that.diaoxiang3.style.cssText="width:0.69rem;height:1.47rem;";
            $(".diaoxiang3 .diaoxiangBox").css("transform","scale(0,0)")
       	},false);
	},
	diaoxiang_btn4:function(){
		var that=this;
		that.diaoxiang4.addEventListener("touchstart",function(e){
            e.preventDefault();
            that.diaoxiang4.style.cssText="width:0.7rem;height:1.2rem;";
            $(".diaoxiang4 .diaoxiangBox").css("transform","scale(1,1)")
            that.yinxiao_btn();
       	},false);
       	that.diaoxiang4.addEventListener("touchend",function(e){
            e.preventDefault();
            that.diaoxiang4.style.cssText="width:0.9rem;height:1.47rem;";
            $(".diaoxiang4 .diaoxiangBox").css("transform","scale(0,0)")
       	},false);
	},
	remove_btn:function(){
		var that=this;
		for(var i = 0;i <that.remove.length;i++){
			that.remove[i].index=i;
			that.remove[i].addEventListener("touchstart",function(e){
	            e.preventDefault();
	            that.remove[this.index].classList.add("rubberBand");
	            setTimeout(function(){
	            	$(".remove").removeClass("rubberBand")
	            },100)
	            that.yinxiao_btn();
	       	},false);
	       	that.remove[i].addEventListener("touchend",function(e){
	            e.preventDefault();
                $(".remove").eq(this.index).parent().removeClass("bounceIn").addClass("bounceOut");
                setTimeout(function(){
                	$(".remove").parent().css("display","none");
                	$(".shade").css("display","none")
                },800)
	       	},false);
		}
	},
	quxiao_btn:function(){
		var that=this;
		for(var i = 0;i <that.quxiao.length;i++){
			that.quxiao[i].index=i;
			that.quxiao[i].addEventListener("touchstart",function(e){
	            e.preventDefault();
	            that.quxiao[this.index].classList.add("rubberBand");
	            setTimeout(function(){
	            	$(".quxiao").removeClass("rubberBand")
	            },100)
	            that.yinxiao_btn();
	       	},false);
	       	that.quxiao[i].addEventListener("touchend",function(e){
	            e.preventDefault();
                $(".quxiao").eq(this.index).parent().removeClass("bounceIn").addClass("bounceOut");
                setTimeout(function(){
                	$(".quxiao").parent().css("display","none");
                	$(".shade").css("display","none")
                },800)
	       	},false);
		}
	},
	queding_btn:function(){
		var that=this;
		for(var i = 0;i <that.queding.length;i++){
			that.queding[i].index=i;
			that.queding[i].addEventListener("touchstart",function(e){
	            e.preventDefault();
	            that.queding[this.index].classList.add("rubberBand");
	            setTimeout(function(){
	            	$(".queding").removeClass("rubberBand")
	            },100)
	            that.yinxiao_btn();
	       	},false);
	       	that.queding[i].addEventListener("touchend",function(e){
	            e.preventDefault();
                $(".queding").eq(this.index).parent().removeClass("bounceIn").addClass("bounceOut");
                setTimeout(function(){
                	$(".queding").parent().css("display","none");
                	$(".buy_cg").css("display","block").removeClass("bounceOut").addClass("bounceIn");
                },800)
	       	},false);
		}
	},
	go_chongzhi_btn:function(){
		var that=this;
		that.go_chongzhi.addEventListener("touchstart",function(e){
            e.preventDefault();
            that.go_chongzhi.classList.add("rubberBand");
            setTimeout(function(){
            	$(".go_chongzhi").removeClass("rubberBand")
            },100)
            that.yinxiao_btn();
       	},false);
       	that.go_chongzhi.addEventListener("touchend",function(e){
            e.preventDefault();
            $(".go_chongzhi").parent().removeClass("bounceIn").addClass("bounceOut");
            setTimeout(function(){
            	$(".go_chongzhi").parent().css("display","none");
            	$(".chongzhiBox").css("display","block").removeClass("bounceOut").addClass("bounceIn");
            },800)
       	},false);
	},
	chongzhi_btn:function(){
		var that=this;
		for(var i = 0;i <that.chongzhiBtn.length;i++){
			that.chongzhiBtn[i].index=i;
			that.chongzhiBtn[i].addEventListener("touchstart",function(e){
	            e.preventDefault();
	            that.chongzhiBtn[this.index].classList.add("rubberBand");
	            setTimeout(function(){
	            	$(".chongzhiBox a").removeClass("rubberBand")
	            },100)
	            that.yinxiao_btn();
	       	},false);
	       	that.chongzhiBtn[i].addEventListener("touchend",function(e){
	            e.preventDefault();
                if(this.index == 0){
                	alert("金币充值")
                }else if(this.index == 1){
                	$(".chongzhiBox").removeClass("bounceIn").addClass("bounceOut");
                	setTimeout(function(){
                		$(".chongzhiBox").css("display","none")
                		$(".chongzhi_mes").css("display","block").removeClass("bounceOut").addClass("bounceIn");
                		$(".chongzhi_mes img").attr("src",PUBLIC+"/gold/img/index/chongzhi_mes/2000.png")
                	},800);
                }else if(this.index == 2){
                	$(".chongzhiBox").removeClass("bounceIn").addClass("bounceOut");
                	setTimeout(function(){
                		$(".chongzhiBox").css("display","none")
                		$(".chongzhi_mes").css("display","block").removeClass("bounceOut").addClass("bounceIn");
                		$(".chongzhi_mes img").attr("src",PUBLIC+"/gold/img/index/chongzhi_mes/20000.png")
                	},800);
                }else{
                	$(".chongzhiBox").removeClass("bounceIn").addClass("bounceOut");
                	setTimeout(function(){
                		$(".chongzhiBox").css("display","none")
                		$(".chongzhi_mes").css("display","block").removeClass("bounceOut").addClass("bounceIn");
                		$(".chongzhi_mes img").attr("src",PUBLIC+"/gold/img/index/chongzhi_mes/200000.png")
                	},800);
                };
	       	},false);
		}
	},
	filter_btn:function(){
		var that=this;
		that.filter.addEventListener("touchstart",function(e){
            e.preventDefault();
            that.filter.classList.add("rubberBand");
            setTimeout(function(){
            	$(".submit").removeClass("rubberBand")
            },100)
            that.yinxiao_btn();
       	},false);
       	that.filter.addEventListener("touchend",function(e){
            e.preventDefault();
       	},false);
	},
	go_friend_btn:function(){
		var that=this;
		that.go_friend.addEventListener("touchstart",function(e){
            e.preventDefault();
            that.go_friend.classList.add("rubberBand");
            setTimeout(function(){
            	$(".find_friend a").removeClass("rubberBand")
            },100)
            that.yinxiao_btn();
       	},false);
       	that.go_friend.addEventListener("touchend",function(e){
            e.preventDefault();
            //去好友农场的跳转
       	},false);
	},
	qiehuan_btn:function(){
		var that=this;
		that.qiehuan.addEventListener("touchstart",function(e){
            e.preventDefault();
            that.qiehuan.classList.add("rubberBand");
            setTimeout(function(){
            	that.qiehuan.classList.remove("rubberBand");
            },100)
            that.yinxiao_btn();
       	},false);
       	that.qiehuan.addEventListener("touchend",function(e){
            e.preventDefault();
            //window.location.href="login.html";
	$.ajax({
                type: "POST",
                url:APP+"/Member/memberLogout.html",
                dataType:"json",
                success: function(msg){

                    datas=eval(msg)

                    if(datas.reTips == 'Success'){

                        window.location.href=APP+"/Index/index.html"

                    }

                },
	})

       	},false);
	},
	audioBtn_btn:function(){
		var that=this;
		that.audioBtn.addEventListener("touchstart",function(e){
            e.preventDefault();
            that.audioBtn.classList.add("rubberBand");
            setTimeout(function(){
            	that.audioBtn.classList.remove("rubberBand");
            },100)
       	},false);
       	that.audioBtn.addEventListener("touchend",function(e){
            e.preventDefault();
            var isPlay;
            if(that.audio1.paused){
            	$(".audio img").css("display","none");
            	that.audioImg.style.background="url("+PUBLIC+"/gold/img/index/shezhi/yinxiaoyikaiqi.png)";
            	that.audioImg.style.backgroundSize="cover";
            	that.audio1.play();

            	isPlay = 'on';
            }else{
            	$(".audio img").css("display","block");
            	that.audioImg.style.background="url("+PUBLIC+"/gold/img/index/shezhi/yinxiaoyiguanbi.png)";
            	that.audioImg.style.backgroundSize="cover";
            	that.audio1.pause()
           		that.audio1.currentTime = 0.0;

				isPlay = 'off';
            };

            $.ajax({
                type: "POST",
                url:APP+"/Farm/farmBgMusic.html",
				data:{isPlay:isPlay},
                dataType:"json",
            })


       	},false);
	},
	left_go:function(){
		var that=this;
		for(var i = 0;i <that.leftBtn.length;i++){
			that.leftBtn[i].index=i;
			that.leftBtn[i].addEventListener("touchstart",function(e){
	            e.preventDefault();
	            that.leftBtn[this.index].classList.add("rubberBand");
	            setTimeout(function(){
	            	$(".leftBtn").removeClass("rubberBand")
	            },100)
	            that.yinxiao_btn();
	       	},false);
	       	that.leftBtn[i].addEventListener("touchend",function(e){
	            e.preventDefault();
                if(this.index == 0){
                	alert("日志上一页")
                }
	       	},false);
		}
	},
	right_go:function(){
		var that=this;
		for(var i = 0;i <that.rightBtn.length;i++){
			that.rightBtn[i].index=i;
			that.rightBtn[i].addEventListener("touchstart",function(e){
	            e.preventDefault();
	            that.rightBtn[this.index].classList.add("rubberBand");
	            setTimeout(function(){
	            	$(".rightBtn").removeClass("rubberBand")
	            },100)
	            that.yinxiao_btn();
	       	},false);
	       	that.rightBtn[i].addEventListener("touchend",function(e){
	            e.preventDefault();
                if(this.index == 0){
                	alert("日志下一页")
                }
	       	},false);
		}
	},
	empty_btn:function(){
		var that=this;
		for(var i = 0;i <that.emptyBtn.length;i++){
			that.emptyBtn[i].index=i;
			that.emptyBtn[i].addEventListener("touchstart",function(e){
	            e.preventDefault();
	            that.emptyBtn[this.index].classList.add("rubberBand");
	            setTimeout(function(){
	            	$(".empty").removeClass("rubberBand")
	            },100)
	            that.yinxiao_btn();
	       	},false);
	       	that.emptyBtn[i].addEventListener("touchend",function(e){
	            e.preventDefault();
                if(this.index == 0){
                	alert("清空日志")
                	$(".rizhiMes").empty();
                }
	       	},false);
		}
	},
	paihang_btn:function(){
		var that=this;
		for(var i = 0;i <that.paihangTop.length;i++){
			that.paihangTop[i].index=i;
			that.paihangTop[i].addEventListener("touchstart",function(e){
	            e.preventDefault();
	            that.paihangTop[this.index].classList.add("rubberBand");
	            setTimeout(function(){
	            	$(".paihangTop li").removeClass("rubberBand")
	            },100)
	            that.yinxiao_btn();
	       	},false);
	       	that.paihangTop[i].addEventListener("touchend",function(e){
	            e.preventDefault();
	            if(this.index == 0){
	            	that.paihangTop[0].style.background="url("+PUBLIC+"/gold/img/index/paihang/nongchangpaiming2.png)";
	            	that.paihangTop[0].style.backgroundSize="cover";
	            	that.paihangTop[1].style.background="url("+PUBLIC+"/gold/img/index/paihang/chongwupaiming2.png)";
	            	that.paihangTop[1].style.backgroundSize="cover";
	            }else{
	            	that.paihangTop[0].style.background="url("+PUBLIC+"/gold/img/index/paihang/nongchangpaiming.png)";
	            	that.paihangTop[0].style.backgroundSize="cover";
	            	that.paihangTop[1].style.background="url("+PUBLIC+"/gold/img/index/paihang/chongwupaiming.png)";
	            	that.paihangTop[1].style.backgroundSize="cover";
	            }
	            $(".paihangBot li").css("display","none").eq(this.index).css("display","block")
	       	},false);
		}
	},
	find_go_btn:function(){
		var that=this;
		that.find_go.addEventListener("touchstart",function(e){
            e.preventDefault();
            that.find_go.classList.add("rubberBand");
            setTimeout(function(){
            	$(".find_go").removeClass("rubberBand")
            },100)
            that.yinxiao_btn();
       	},false);
       	that.find_go.addEventListener("touchend",function(e){
            e.preventDefault();
            $(".paihangbang").removeClass("bounceIn").addClass("bounceOut");
            	setTimeout(function(){
            		$(".paihangbang").css("display","none")
            		$(".find_friend").css("display","block").removeClass("bounceOut").addClass("bounceIn");
            	},800);
       	},false);
	},
	gerenImg_btn:function(){
		var that=this;
		that.gerenImg.addEventListener("touchstart",function(e){
            e.preventDefault();
            that.gerenImg.classList.add("rubberBand");
            setTimeout(function(){
            	$(".gerenBox img").removeClass("rubberBand")
            },100)
            that.yinxiao_btn();
       	},false);
       	that.gerenImg.addEventListener("touchend",function(e){
            e.preventDefault();
            $(".shade").css("display","block");
            $(".gerenMesBox").css("display","block").removeClass("bounceOut").addClass("bounceIn")
       	},false);
	},
	pandaTop_btn:function(){
		var that=this;
		for(var i = 0;i <that.pandaTop.length;i++){
			that.pandaTop[i].index=i;
			that.pandaTop[i].addEventListener("touchstart",function(e){
	            e.preventDefault();
	            that.pandaTop[this.index].classList.add("rubberBand");
	            setTimeout(function(){
	            	$(".pandaTop li").removeClass("rubberBand")
	            },100)
	            that.yinxiao_btn();
	       	},false);
	       	that.pandaTop[i].addEventListener("touchend",function(e){
	            e.preventDefault();
	            if(this.index == 0){
	            	that.pandaTop[0].style.background="url("+PUBLIC+"/gold/img/index/chongwu/jineng2.png)";
	            	that.pandaTop[0].style.backgroundSize="cover";
	            	that.pandaTop[1].style.background="url("+PUBLIC+"/gold/img/index/chongwu/xinxi.png)";
	            	that.pandaTop[1].style.backgroundSize="cover";
	            }else{
	            	that.pandaTop[0].style.background="url("+PUBLIC+"/gold/img/index/chongwu/jineng.png)";
	            	that.pandaTop[0].style.backgroundSize="cover";
	            	that.pandaTop[1].style.background="url("+PUBLIC+"/gold/img/index/chongwu/xinxi2.png)";
	            	that.pandaTop[1].style.backgroundSize="cover";
	            }
	            $(".pandaBot li").css("display","none").eq(this.index).css("display","block")
	       	},false);
		}
	},
	getjineng_btn:function(){
		var that=this;
		for(var i = 0;i <that.getjineng.length;i++){
			that.getjineng[i].index=i;
			that.getjineng[i].addEventListener("touchstart",function(e){
	            e.preventDefault();
	            that.getjineng[this.index].classList.add("rubberBand");
	            setTimeout(function(){
	            	$(".paihangBot li:nth-of-type(2) a").removeClass("rubberBand")
	            },100)
	            that.yinxiao_btn();
	       	},false);
	       	that.getjineng[i].addEventListener("touchend",function(e){
	            e.preventDefault();
	            if(this.index == 0){
	            	alert("自动收获")
	            }else if(this.index == 1){
	            	alert("自动播种")
	            }else if(this.index == 2){
	            	alert("玫瑰之心")
	            }
	       	},false);
		}
	},
	xunlianBtn_btn:function(){
		var that=this;
		that.xunlianBtn.addEventListener("touchstart",function(e){
            e.preventDefault();
            that.xunlianBtn.classList.add("rubberBand");
            setTimeout(function(){
            	$(".xunlian").removeClass("rubberBand")
            },100)
            that.yinxiao_btn();
       	},false);
       	that.xunlianBtn.addEventListener("touchend",function(e){
            e.preventDefault();
            //训练
       	},false);
	},
	weishiBtn_btn:function(){
		var that=this;
		that.weishiBtn.addEventListener("touchstart",function(e){
            e.preventDefault();
            that.weishiBtn.classList.add("rubberBand");
            setTimeout(function(){
            	$(".weishi").removeClass("rubberBand")
            },100)
            that.yinxiao_btn();
       	},false);
       	that.weishiBtn.addEventListener("touchend",function(e){
            e.preventDefault();
            //喂食
       	},false);
	},
	pandaJia_btn:function(){
		var that=this;
		that.pandaJia.addEventListener("touchstart",function(e){
            e.preventDefault();
            that.pandaJia.classList.add("rubberBand");
            setTimeout(function(){
            	$(".pandaJia").removeClass("rubberBand")
            },100)
            that.yinxiao_btn();
       	},false);
       	that.pandaJia.addEventListener("touchend",function(e){
            e.preventDefault();
            var val=$(".pandaCount").html();
            val++;
            $(".pandaCount").html(val);
       	},false);
	},
	pandaJian_btn:function(){
		var that=this;
		that.pandaJian.addEventListener("touchstart",function(e){
            e.preventDefault();
            that.pandaJian.classList.add("rubberBand");
            setTimeout(function(){
            	$(".pandaJian").removeClass("rubberBand")
            },100)
            that.yinxiao_btn();
       	},false);
       	that.pandaJian.addEventListener("touchend",function(e){
            e.preventDefault();
            var val=$(".pandaCount").html();
            val--;
            if(val<0){val=0}
            $(".pandaCount").html(val);
       	},false);
	},
	changeName_btn:function(){
		var that=this;
		that.changeName.addEventListener("touchstart",function(e){
            e.preventDefault();
            that.changeName.classList.add("rubberBand");
            setTimeout(function(){
            	$(".changeName").removeClass("rubberBand")
            },100)
            that.yinxiao_btn();
       	},false);
       	that.changeName.addEventListener("touchend",function(e){
            e.preventDefault();
            if(that.changeFlag == true){
            	that.changeName.classList.add("changeQueren");
	            $(".pandaBot li:nth-of-type(1) input").removeAttr("readonly");
	            that.changeFlag=false;
            }else{
            	that.changeName.classList.remove("changeQueren");
	            $(".pandaBot li:nth-of-type(1) input").attr("readonly","readonly");
	            that.changeFlag=true;
            }
            
       	},false);
	},
	cangkuList_btn:function(){
		var that=this;
		for(var i = 0;i <that.cangkuList.length;i++){
			that.cangkuList[i].index=i;
			that.cangkuList[i].addEventListener("touchstart",function(e){
	            e.preventDefault();
	            that.cangkuList[this.index].classList.add("rubberBand");
	            setTimeout(function(){
	            	$(".cangkuTop li").removeClass("rubberBand")
	            },100)
	            that.yinxiao_btn();
	       	},false);
	       	that.cangkuList[i].addEventListener("touchend",function(e){
	            e.preventDefault();
	            $(".cangkuTop li img:nth-of-type(2)").css("display","none").eq(this.index).css("display","block")
	            $(".cangkuBot li").css("display","none").eq(this.index).css("display","block")
	       	},false);
		}
	},
	duihuanList_btn:function(){
		var that=this;
		for(var i = 0;i <that.cangkuList.length;i++){
			that.duihuanList[i].index=i;
			that.duihuanList[i].addEventListener("touchstart",function(e){
	            e.preventDefault();
	            that.duihuanList[this.index].classList.add("rubberBand");
	            setTimeout(function(){
	            	$(".duihuanTop li").removeClass("rubberBand")
	            },100)
	            that.yinxiao_btn();
	       	},false);
	       	that.duihuanList[i].addEventListener("touchend",function(e){
	            e.preventDefault();
	            $(".duihuanTop li img:nth-of-type(2)").css("display","none").eq(this.index).css("display","block")
	            $(".duihuanBot li").css("display","none").eq(this.index).css("display","block")
	       	},false);
		}
	},
	duihuan_btn:function(){
		var that=this;
		for(var i = 0;i <that.duihuan.length;i++){
			that.duihuan[i].index=i;
			that.duihuan[i].addEventListener("touchstart",function(e){
	            e.preventDefault();
	            that.duihuan[this.index].classList.add("rubberBand");
	            setTimeout(function(){
	            	$(".shuiguoduihuan").removeClass("rubberBand")
	            },100)
	            that.yinxiao_btn();
	       	},false);
	       	that.duihuan[i].addEventListener("touchend",function(e){
	            e.preventDefault();
	            if(this.index == 0){
	            	$(".duihuan_chenggong").css("display","block").removeClass("bounceOut").addClass("bounceIn");
		            $(".duihuan_chenggong").html("兑换成功")
		            setTimeout(function(){
		            	$(".duihuan_chenggong").removeClass("bounceIn").addClass("bounceOut");
		            	setTimeout(function(){
		            		$(".duihuan_chenggong").css("display","none")
		            	},800)
		            },1500)
	            }else{
	            	$(".duihuan_shibai").css("display","block").removeClass("bounceOut").addClass("bounceIn");
		            $(".duihuan_shibai").html("兑换失败，萝卜不足")
		            setTimeout(function(){
		            	$(".duihuan_shibai").removeClass("bounceIn").addClass("bounceOut");
		            	setTimeout(function(){
		            		$(".duihuan_shibai").css("display","none")
		            	},800)
		            },1500)
	            }
	       	},false);
		}
	},
	shangdianList_btn:function(){
		var that=this;
		for(var i = 0;i <that.shangdianList.length;i++){
			that.shangdianList[i].index=i;
			that.shangdianList[i].addEventListener("touchstart",function(e){
	            e.preventDefault();
	            that.shangdianList[this.index].classList.add("rubberBand");
	            setTimeout(function(){
	            	$(".shangdianTop li").removeClass("rubberBand")
	            },100)
	            that.yinxiao_btn();
	       	},false);
	       	that.shangdianList[i].addEventListener("touchend",function(e){
	            e.preventDefault();

	            //加载商店选项卡数据
                /*var thisType = this.index+1;
                $.ajax({

                    type: "POST",
                    url:APP+"/Farm/commodityList.html",
                    data:{typeId:thisType},
                    dataType:"json",
                    beforeSend:function(){
                        $('shangdianBot').empty()
                    },
                    success: function(data){

                        datas=eval(data)

                        if(datas != null) {

                            var count = datas.length;

                            for (var i = 0; i < count; i++) {

                                var industry = datas[i];


                                $('.shangdianBot').html(
                                    "<li>"
                                    + " <div class='gongyongList'>"
                                    + "<div class='dhImgLeft'><img src='"+PUBLIC + "/UploadFiles_s/"+ industry.com_img + "' alt='' /></div>"
                                    + "<div class='shuiguogoumai animated'></div>"
                                    + "<p>" + industry.com_name + "x1000</p>"
                                    + "<p>" + industry.com_describe + "</p>"
                                    + "<p>钻石：" + industry.com_price + "</p>"
                                    + "<p>剩余" + industry.com_sum + "万</p>"
                                    + "</div>"
                                    + "</li>"
                                );
                            }

                        }


                    },
                })*/

	            $(".shangdianTop li img:nth-of-type(2)").css("display","none").eq(this.index).css("display","block")
	            $(".shangdianBot li").css("display","none").eq(this.index).css("display","block")
	       	},false);
		}
	},
	shangdian_btn:function(){
		var that=this;
		for(var i = 0;i <that.shangdian.length;i++){
			that.shangdian[i].index=i;
			that.shangdian[i].addEventListener("touchstart",function(e){
	            e.preventDefault();
	            that.shangdian[this.index].classList.add("rubberBand");
	            setTimeout(function(){
	            	$(".shuiguogoumai").removeClass("rubberBand")
	            },100)
	            that.yinxiao_btn();
	       	},false);
	       	that.shangdian[i].addEventListener("touchend",function(e){
	            e.preventDefault();

				//购买商店商品
                var commodityId=$(".shuiguogoumai").eq(this.index).siblings("input").val();
                $.ajax({

                    type: "POST",
                    url:APP+"/Farm/buyCommodity.html",
                    data:{commodityId:commodityId},
                    dataType:"json",
                    beforeSend:function(){
                    },
                    success: function(data){

                        datas=eval(data)

                        if(datas.reTips == 'Success'){
                            $(".duihuan_chenggong").css("display","block").removeClass("bounceOut").addClass("bounceIn");
                            $(".duihuan_chenggong").html(datas.reMsg)
                            setTimeout(function(){
                                $(".duihuan_chenggong").removeClass("bounceIn").addClass("bounceOut");
                                setTimeout(function(){
                                    $(".duihuan_chenggong").css("display","none")
                                },800)
                            },1500)
                            location.reload()
                        }else{
                            $(".duihuan_shibai").css("display","block").removeClass("bounceOut").addClass("bounceIn");
                            $(".duihuan_shibai").html(datas.reMsg)
                            setTimeout(function(){
                                $(".duihuan_shibai").removeClass("bounceIn").addClass("bounceOut");
                                setTimeout(function(){
                                    $(".duihuan_shibai").css("display","none")
                                },800)
                            },1500)
                        }



                    },
                })

	            /*if(this.index == 0){
	            	$(".duihuan_chenggong").css("display","block").removeClass("bounceOut").addClass("bounceIn");
	            	$(".duihuan_chenggong").html("购买成功")
		            setTimeout(function(){
		            	$(".duihuan_chenggong").removeClass("bounceIn").addClass("bounceOut");
		            	setTimeout(function(){
		            		$(".duihuan_chenggong").css("display","none")
		            	},800)
		            },1500)
	            }else{
	            	$(".duihuan_shibai").css("display","block").removeClass("bounceOut").addClass("bounceIn");
	            	$(".duihuan_shibai").html("购买失败，钻石不足")
		            setTimeout(function(){
		            	$(".duihuan_shibai").removeClass("bounceIn").addClass("bounceOut");
		            	setTimeout(function(){
		            		$(".duihuan_shibai").css("display","none")
		            	},800)
		            },1500)
	            }*/
	       	},false);
		}
	},
	shuiguoJia_btn:function(){
		var that=this;
		for(var i = 0;i <that.shuiguoJia.length;i++){
			that.shuiguoJia[i].index=i;
			that.shuiguoJia[i].addEventListener("touchstart",function(e){
	            e.preventDefault();
	            that.shuiguoJia[this.index].classList.add("rubberBand");
	            setTimeout(function(){
	            	$(".shuiguoJia").removeClass("rubberBand")
	            },100)
	            that.yinxiao_btn();
	       	},false);
	       	that.shuiguoJia[i].addEventListener("touchend",function(e){
	            e.preventDefault();
	            var val=$(".shuiguoJia").eq(this.index).parent().find(".shuiguoCount").html();
	            val++;
	            $(".shuiguoJia").eq(this.index).parent().find(".shuiguoCount").html(val);
	       	},false);
		}
	},
	shuiguoJian_btn:function(){
		var that=this;
		for(var i = 0;i <that.shuiguoJian.length;i++){
			that.shuiguoJian[i].index=i;
			that.shuiguoJian[i].addEventListener("touchstart",function(e){
	            e.preventDefault();
	            that.shuiguoJian[this.index].classList.add("rubberBand");
	            setTimeout(function(){
	            	$(".shuiguoJian").removeClass("rubberBand")
	            },100)
	            that.yinxiao_btn();
	       	},false);
	       	that.shuiguoJian[i].addEventListener("touchend",function(e){
	            e.preventDefault();
	            var val=$(".shuiguoJian").eq(this.index).parent().find(".shuiguoCount").html();
	            val--;
	            if(val<0){val=0}
	            $(".shuiguoJian").eq(this.index).parent().find(".shuiguoCount").html(val);
	       	},false);
		}
	},
	jiansheList_btn:function(){
		var that=this;
		for(var i = 0;i <that.jiansheList.length;i++){
			that.jiansheList[i].index=i;
			that.jiansheList[i].addEventListener("touchstart",function(e){
	            e.preventDefault();
	            that.jiansheList[this.index].classList.add("rubberBand");
	            setTimeout(function(){
	            	$(".jiansheTop li").removeClass("rubberBand")
	            },100)
	            that.yinxiao_btn();
	       	},false);
	       	that.jiansheList[i].addEventListener("touchend",function(e){
	            e.preventDefault();
	            $(".jiansheTop li img:nth-of-type(2)").css("display","none").eq(this.index).css("display","block")
	            $(".jiansheBot li").css("display","none").eq(this.index).css("display","block")
	       	},false);
		}
	},
	tudishengji_btn:function(){
		var that=this;
		for(var i = 0;i <that.tudishengji.length;i++){
			that.tudishengji[i].index=i;
			that.tudishengji[i].addEventListener("touchstart",function(e){
	            e.preventDefault();
	            that.tudishengji[this.index].classList.add("rubberBand");
	            setTimeout(function(){
	            	$(".tudishengji").removeClass("rubberBand")
	            },100)
	            that.yinxiao_btn();
	       	},false);
	       	that.tudishengji[i].addEventListener("touchend",function(e){
	            e.preventDefault();
	            if(this.index == 0){
	            	$(".duihuan_chenggong").css("display","block").removeClass("bounceOut").addClass("bounceIn");
	            	$(".duihuan_chenggong").html("升级成功")
		            setTimeout(function(){
		            	$(".duihuan_chenggong").removeClass("bounceIn").addClass("bounceOut");
		            	setTimeout(function(){
		            		$(".duihuan_chenggong").css("display","none")
		            	},800)
		            },1500)
	            }else{
	            	$(".duihuan_shibai").css("display","block").removeClass("bounceOut").addClass("bounceIn");
	            	$(".duihuan_shibai").html("升级失败，材料不足")
		            setTimeout(function(){
		            	$(".duihuan_shibai").removeClass("bounceIn").addClass("bounceOut");
		            	setTimeout(function(){
		            		$(".duihuan_shibai").css("display","none")
		            	},800)
		            },1500)
	            }
	       	},false);
		}
	},
	yinxiao_btn:function(){
		var that=this;
		that.yinxiao.play();
		setTimeout(function(){
			that.yinxiao.pause()
       		that.yinxiao.currentTime = 0.0; 
		},800)
		
	},
	BigHouse_btn:function(){
		var that=this;
		that.BigHouse.addEventListener("touchstart",function(e){
            e.preventDefault();
            that.BigHouse.classList.add("rubberBand");
	            setTimeout(function(){
	            	$(".BigHouse").removeClass("rubberBand")
	            },100)
            that.yinxiao_btn();
       	},false);
       	that.BigHouse.addEventListener("touchend",function(e){
            e.preventDefault();
            $(".shade").css("display","block");
            		$(".jiansheBox").css("display","block").removeClass("bounceOut").addClass("bounceIn")
       	},false);
	},
	SmallHouse_btn:function(){
		var that=this;
		that.SmallHouse.addEventListener("touchstart",function(e){
            e.preventDefault();
            that.SmallHouse.classList.add("rubberBand");
	            setTimeout(function(){
	            	$(".SmallHouse").removeClass("rubberBand")
	            },100)
            that.yinxiao_btn();
       	},false);
       	that.SmallHouse.addEventListener("touchend",function(e){
            e.preventDefault();
            $(".shade").css("display","block");
            $(".sico_chongwu_Box").css("display","block").removeClass("bounceOut").addClass("bounceIn")
       	},false);
	},
	html_arr:function(){
		$(".panda p").css("display","block").html(this.htmlArr[Math.floor(Math.random()*this.htmlArr.length)]);
		setTimeout(function(){
			$(".panda p").css("display","none");
		},3000)
	},
	html_arr_btn:function(){
		var that=this;
		that.html_arr();
		setInterval(function(){
			that.html_arr();
		},10000)
	}
};


//游戏
function game(){
	this.btn_animate=new btn();
	this.tudi=$(".easte li");
	this.bozhong=$(".bozhongBtn");
	this.chanchu=$(".chanchuBtn");
	this.jiaoshui=$(".jiaoshuiBtn");
	this.shifei=$(".shifeiBtn");
	this.shouge=$(".shougeBtn");
	this.xinxi=$(".xinxiBtn");
	this.bozhongYes=$(".bozhongYes")[0];
	this.chanchuYes=$(".chanchuYes")[0];
	this.shifeiYes=$(".shifeiYes")[0];
	this.xinxiYes=$(".xinxiYes")[0];
};
game.prototype={
	play:function(){
		var that=this;
		that.btn_animate.init();
		that.tudi_btn();
		that.bozhong_btn();
		that.chanchu_btn();
		that.jiaoshui_btn();
		that.shifei_btn();
		that.shouge_btn();
		that.xinxi_btn();
	},
	tudi_btn:function(){
		var that=this;
		for(var i = 0;i <that.tudi.length;i++){
			that.tudi[i].index=i;
			that.tudi[i].addEventListener("touchstart",function(e){
	            e.preventDefault();
                $(".easte li").eq(this.index).find(".opacity").css("opacity",1)
                that.btn_animate.yinxiao_btn();
	       	},false);
	       	that.tudi[i].addEventListener("touchend",function(e){
	            e.preventDefault();
                $(".easte li").eq(this.index).find(".opacity").css("opacity",0);
                if($(".easte li").eq(this.index).hasClass("kaiken")){
                	$(".caozuoBtn").css({
                		"opacity":0,
                		"right":"0.4rem",
                		"bottom":0,
                		"z-index":0
                	})
                	$(".shade").css("display","block");
            		$(".jiansheBox").css("display","block").removeClass("bounceOut").addClass("bounceIn")
                }else if($(".easte li").eq(this.index).hasClass("bozhong")){
                	$(".caozuoBtn").css({
                		"opacity":0,
                		"right":"0.4rem",
                		"bottom":0,
                		"z-index":0
                	})
                	$(".easte li").eq(this.index).find(".caozuoBtn").eq(0).css({
                		"opacity":1,
                		"right":"0.9rem",
                		"bottom":"0.6rem",
                		"z-index":2
                	})
                }else if($(".easte li").eq(this.index).hasClass("chanchu_jiaoshui")){
                	$(".caozuoBtn").css({
                		"opacity":0,
                		"right":"0.4rem",
                		"bottom":0,
                		"z-index":0
                	})
                	$(".easte li").eq(this.index).find(".caozuoBtn").eq(1).css({
                		"opacity":1,
                		"right":"1.1rem",
                		"bottom":"0.3rem",
                		"z-index":2
                	})
                	$(".easte li").eq(this.index).find(".caozuoBtn").eq(2).css({
                		"opacity":1,
                		"right":"0.6rem",
                		"bottom":"0.7rem",
                		"z-index":2
                	})
                }else if($(".easte li").eq(this.index).hasClass("jiaoshui_shifei")){
                	$(".caozuoBtn").css({
                		"opacity":0,
                		"right":"0.4rem",
                		"bottom":0,
                		"z-index":0
                	})
                	$(".easte li").eq(this.index).find(".caozuoBtn").eq(2).css({
                		"opacity":1,
                		"right":"1.1rem",
                		"bottom":"0.3rem",
                		"z-index":2
                	})
                	$(".easte li").eq(this.index).find(".caozuoBtn").eq(3).css({
                		"opacity":1,
                		"right":"0.6rem",
                		"bottom":"0.7rem",
                		"z-index":2
                	})
                }else if($(".easte li").eq(this.index).hasClass("shifei_shouge")){
                	$(".caozuoBtn").css({
                		"opacity":0,
                		"right":"0.4rem",
                		"bottom":0,
                		"z-index":0
                	})
                	$(".easte li").eq(this.index).find(".caozuoBtn").eq(4).css({
                		"opacity":1,
                		"right":"1.1rem",
                		"bottom":"0.3rem",
                		"z-index":2
                	})
                	$(".easte li").eq(this.index).find(".caozuoBtn").eq(5).css({
                		"opacity":1,
                		"right":"0.6rem",
                		"bottom":"0.7rem",
                		"z-index":2
                	})
                }
	       	},false);
		}
	},
	bozhong_btn:function(){
		var that=this;
		for(var i = 0;i <that.bozhong.length;i++){
			that.bozhong[i].index=i;
			that.bozhong[i].addEventListener("touchstart",function(e){
	            e.preventDefault();
	            that.btn_animate.yinxiao_btn();
	       	},false);
	       	that.bozhong[i].addEventListener("touchend",function(e){
	            e.preventDefault();
	            //alert("播种第"+this.index+"地");
	            $(".shade").css("display","block");
            	$(".bozhongAlert").css("display","block").removeClass("bounceOut").addClass("bounceIn");
            	if(this.index == 0){
            		that.bozhongYes_btn(true);
            	}else{
            		that.bozhongYes_btn(false);
            	}
	       	},false);
       	}
	},
	chanchu_btn:function(){
		var that=this;
		for(var i = 0;i <that.chanchu.length;i++){
			that.chanchu[i].index=i;
			that.chanchu[i].addEventListener("touchstart",function(e){
	            e.preventDefault();
	            that.btn_animate.yinxiao_btn();
	       	},false);
	       	that.chanchu[i].addEventListener("touchend",function(e){
	            e.preventDefault();
	            alert("铲除第"+this.index+"地");
	            $(".shade").css("display","block");
            	$(".chanchuAlert").css("display","block").removeClass("bounceOut").addClass("bounceIn");
            	if(this.index == 2){
            		that.chanchuYes_btn(true);
            	}else{
            		that.chanchuYes_btn(false);
            	}
	       	},false);
       	}
	},
	jiaoshui_btn:function(){
		var that=this;
		for(var i = 0;i <that.jiaoshui.length;i++){
			that.jiaoshui[i].index=i;
			that.jiaoshui[i].addEventListener("touchstart",function(e){
	            e.preventDefault();
	            that.btn_animate.yinxiao_btn();
	       	},false);
	       	that.jiaoshui[i].addEventListener("touchend",function(e){
	            e.preventDefault();
	            alert("浇水第"+this.index+"地")
	            if(this.index == 2){
	            	$(".shade").css("display","block");
	            	$(".duihuan_chenggong").css("display","block").removeClass("bounceOut").addClass("bounceIn");
	            	$(".duihuan_chenggong").html("浇水成功")
		            setTimeout(function(){
		            	$(".duihuan_chenggong").removeClass("bounceIn").addClass("bounceOut");
		            	setTimeout(function(){
		            		$(".duihuan_chenggong").css("display","none");
		            		$(".shade").css("display","none");
		            	},800)
		            },1500)
	            }else{
	            	$(".shade").css("display","block");
	            	$(".duihuan_shibai").css("display","block").removeClass("bounceOut").addClass("bounceIn");
	            	$(".duihuan_shibai").html("浇水失败，材料不足")
		            setTimeout(function(){
		            	$(".duihuan_shibai").removeClass("bounceIn").addClass("bounceOut");
		            	setTimeout(function(){
		            		$(".duihuan_shibai").css("display","none");
		            		$(".shade").css("display","none");
		            	},800)
		            },1500)
	            }
	       	},false);
       	}
	},
	shifei_btn:function(){
		var that=this;
		for(var i = 0;i <that.shifei.length;i++){
			that.shifei[i].index=i;
			that.shifei[i].addEventListener("touchstart",function(e){
	            e.preventDefault();
	            that.btn_animate.yinxiao_btn();
	       	},false);
	       	that.shifei[i].addEventListener("touchend",function(e){
	            e.preventDefault();
	            alert("施肥第"+this.index+"地")
	            $(".shade").css("display","block");
            	$(".shifeiAlert").css("display","block").removeClass("bounceOut").addClass("bounceIn");
            	if(this.index == 3){
            		that.shifeiYes_btn(true);
            	}else{
            		that.shifeiYes_btn(false);
            	}
	       	},false);
       	}
	},
	shouge_btn:function(){
		var that=this;
		for(var i = 0;i <that.shouge.length;i++){
			that.shouge[i].index=i;
			that.shouge[i].addEventListener("touchstart",function(e){
	            e.preventDefault();
	            that.btn_animate.yinxiao_btn();
	       	},false);
	       	that.shouge[i].addEventListener("touchend",function(e){
	            e.preventDefault();
	            alert("收割第"+this.index+"地")
	            if(this.index == 4){
	            	$(".shade").css("display","block");
	            	$(".duihuan_chenggong").css("display","block").removeClass("bounceOut").addClass("bounceIn");
	            	$(".duihuan_chenggong").html("收割成功")
		            setTimeout(function(){
		            	$(".duihuan_chenggong").removeClass("bounceIn").addClass("bounceOut");
		            	setTimeout(function(){
		            		$(".duihuan_chenggong").css("display","none");
		            		$(".shade").css("display","none");
		            	},800)
		            },1500)
	            }else{
	            	$(".shade").css("display","block");
	            	$(".duihuan_shibai").css("display","block").removeClass("bounceOut").addClass("bounceIn");
	            	$(".duihuan_shibai").html("收割失败，作物未熟")
		            setTimeout(function(){
		            	$(".duihuan_shibai").removeClass("bounceIn").addClass("bounceOut");
		            	setTimeout(function(){
		            		$(".duihuan_shibai").css("display","none");
		            		$(".shade").css("display","none");
		            	},800)
		            },1500)
	            }
	       	},false);
       	}
	},
	xinxi_btn:function(){
		var that=this;
		for(var i = 0;i <that.xinxi.length;i++){
			that.xinxi[i].index=i;
			that.xinxi[i].addEventListener("touchstart",function(e){
	            e.preventDefault();
	            that.btn_animate.yinxiao_btn();
	       	},false);
	       	that.xinxi[i].addEventListener("touchend",function(e){
	            e.preventDefault();
	            /*alert("信息第"+this.index+"地")
	            $(".shade").css("display","block");
            	$(".xinxiAlert").css("display","block").removeClass("bounceOut").addClass("bounceIn");
            	that.xinxiYes_btn(this.index);*/
	       	},false);
       	}
	},
	bozhongYes_btn:function(flag){
		var that=this;
		that.flag=flag || null;
		that.bozhongYes.addEventListener("touchstart",function(e){
            e.preventDefault();
            that.bozhongYes.classList.add("rubberBand");
            setTimeout(function(){
            	$(".bozhongYes").removeClass("rubberBand")
            },100)
            that.btn_animate.yinxiao_btn();
       	},false);
       	that.bozhongYes.addEventListener("touchend",function(e){
            e.preventDefault();
            if(that.flag == true){
            	$(".duihuan_chenggong").css("display","block").removeClass("bounceOut").addClass("bounceIn");
            	$(".duihuan_chenggong").html("播种成功")
	            setTimeout(function(){
	            	$(".duihuan_chenggong").removeClass("bounceIn").addClass("bounceOut");
	            	$(".bozhongAlert").removeClass("bounceIn").addClass("bounceOut");
	            	setTimeout(function(){
	            		$(".duihuan_chenggong").css("display","none");
	            		$(".bozhongAlert").css("display","none");
                		$(".shade").css("display","none");
	            	},800)
	            },1500)
            }else{
            	$(".duihuan_shibai").css("display","block").removeClass("bounceOut").addClass("bounceIn");
            	$(".duihuan_shibai").html("播种失败,材料不足")
	            setTimeout(function(){
	            	$(".duihuan_shibai").removeClass("bounceIn").addClass("bounceOut");
	            	$(".bozhongAlert").removeClass("bounceIn").addClass("bounceOut");
	            	setTimeout(function(){
	            		$(".duihuan_shibai").css("display","none");
	            		$(".bozhongAlert").css("display","none");
                		$(".shade").css("display","none");
	            	},800)
	            },1500)
            }
            
       	},false);
	},
	chanchuYes_btn:function(flag){
		var that=this;
		that.flag=flag || null;
		that.chanchuYes.addEventListener("touchstart",function(e){
            e.preventDefault();
            that.chanchuYes.classList.add("rubberBand");
            setTimeout(function(){
            	$(".chanchuYes").removeClass("rubberBand")
            },100)
            that.btn_animate.yinxiao_btn();
       	},false);
       	that.chanchuYes.addEventListener("touchend",function(e){
            e.preventDefault();
            if(that.flag == true){
            	$(".duihuan_chenggong").css("display","block").removeClass("bounceOut").addClass("bounceIn");
            	$(".duihuan_chenggong").html("铲除成功")
	            setTimeout(function(){
	            	$(".duihuan_chenggong").removeClass("bounceIn").addClass("bounceOut");
	            	$(".chanchuAlert").removeClass("bounceIn").addClass("bounceOut");
	            	setTimeout(function(){
	            		$(".duihuan_chenggong").css("display","none");
	            		$(".chanchuAlert").css("display","none");
                		$(".shade").css("display","none");
	            	},800)
	            },1500)
            }else{
            	$(".duihuan_shibai").css("display","block").removeClass("bounceOut").addClass("bounceIn");
            	$(".duihuan_shibai").html("铲除失败,金币不足")
	            setTimeout(function(){
	            	$(".duihuan_shibai").removeClass("bounceIn").addClass("bounceOut");
	            	$(".chanchuAlert").removeClass("bounceIn").addClass("bounceOut");
	            	setTimeout(function(){
	            		$(".duihuan_shibai").css("display","none");
	            		$(".chanchuAlert").css("display","none");
                		$(".shade").css("display","none");
	            	},800)
	            },1500)
            }
            
       	},false);
	},
	shifeiYes_btn:function(flag){
		var that=this;
		that.flag=flag || null;
		that.shifeiYes.addEventListener("touchstart",function(e){
            e.preventDefault();
            that.shifeiYes.classList.add("rubberBand");
            setTimeout(function(){
            	$(".shifeiYes").removeClass("rubberBand")
            },100)
            that.btn_animate.yinxiao_btn();
       	},false);
       	that.shifeiYes.addEventListener("touchend",function(e){
            e.preventDefault();
            if(that.flag == true){
            	$(".duihuan_chenggong").css("display","block").removeClass("bounceOut").addClass("bounceIn");
            	$(".duihuan_chenggong").html("施肥成功")
	            setTimeout(function(){
	            	$(".duihuan_chenggong").removeClass("bounceIn").addClass("bounceOut");
	            	$(".shifeiAlert").removeClass("bounceIn").addClass("bounceOut");
	            	setTimeout(function(){
	            		$(".duihuan_chenggong").css("display","none");
	            		$(".shifeiAlert").css("display","none");
                		$(".shade").css("display","none");
	            	},800)
	            },1500)
            }else{
            	$(".duihuan_shibai").css("display","block").removeClass("bounceOut").addClass("bounceIn");
            	$(".duihuan_shibai").html("施肥失败,金币不足")
	            setTimeout(function(){
	            	$(".duihuan_shibai").removeClass("bounceIn").addClass("bounceOut");
	            	$(".shifeiAlert").removeClass("bounceIn").addClass("bounceOut");
	            	setTimeout(function(){
	            		$(".duihuan_shibai").css("display","none");
	            		$(".shifeiAlert").css("display","none");
                		$(".shade").css("display","none");
	            	},800)
	            },1500)
            }
            
       	},false);
	},
	xinxiYes_btn:function(id){
		var that=this;
		that.id=id;
		that.xinxiYes.addEventListener("touchstart",function(e){
            e.preventDefault();
            that.xinxiYes.classList.add("rubberBand");
            setTimeout(function(){
            	$(".xinxiYes").removeClass("rubberBand")
            },100);
            that.btn_animate.yinxiao_btn();
       	},false);
       	that.xinxiYes.addEventListener("touchend",function(e){
            e.preventDefault();
            $(".xinxiAlert").removeClass("bounceIn").addClass("bounceOut");
            setTimeout(function(){
            	$(".xinxiAlert").css("display","none");
            	$(".shade").css("display","block");
            	$(".jiansheBox").css("display","block").removeClass("bounceOut").addClass("bounceIn");
            },800)
            //alert(that.id);这是索引值
       	},false);
	}
};
var playGame=new game();
playGame.play();

//金币掉落

var arr=[]
var cw=document.documentElement.clientWidth;
var ch=document.documentElement.clientHeight;
var iconImgBox=document.getElementById("iconImgBox");
function iconAnimate(){
	for(var i=0;i<20;i++){
	    var div=document.createElement("img");
	    div.src=PUBLIC+"/gold/img/icon.png";
	    div.className="ceshiImg";
	    div.style.cssText="width:30px;height:30px;position: absolute;left:"+((Math.random()*(cw-10))+5)+"px;top:-50px;background:none;"
	    arr.push(div)
	    iconImgBox.appendChild(div)
	}
	for(var i=0;i<arr.length;i++){
	    arr[i].className="iconAnimate";
	    $(".iconAnimate").each(function(){
	    	$(this).css({
		    	"-webkit-animation-duration":(4+5*Math.random())+"s",
		    	"animation-duration":(4+5*Math.random())+"s"
	    	})
	    })
	}
	setTimeout(function(){
		$("#iconImgBox").empty();
	},8000)
}
setInterval(function(){
	iconAnimate()
},20000)
iconAnimate()
/* 
 * 
 */
})
